package com.uzai.console.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.uzai.console.dto.groupsendjob.GroupSendJobQuery;
import com.uzai.console.entity.GroupSendJob;
import io.swagger.models.auth.In;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;

@Repository
public interface GroupSendJobMapper {
    int deleteById(@Param("id") Long id, @Param("merId") Long merId);

    int deleteByParentId(@Param("parentId") Long parentId, @Param("merId") Long merId);

    int insert(GroupSendJob record);

    int insertSelective(GroupSendJob record);

    GroupSendJob selectById(@Param("id") Long id, @Param("merId") Long merId);

    int updateByIdSelective(GroupSendJob record);

    int updateById(GroupSendJob record);

    int updateByParentId(GroupSendJob record);

    int updateStatusByParentId(@Param("status") Integer status, @Param("parentId") Long parentId, @Param("merId") Long merId);

    int updateTotalCountById(GroupSendJob record);

    /**
     * 分页查询
     * @param page
     * @param query
     * @return
     */
    ArrayList<GroupSendJob> findByList(Page<GroupSendJob> page, @Param("query") GroupSendJobQuery query);

    /**
     * 查询所有
     * @param query
     * @return
     */
    ArrayList<GroupSendJob> findByList(@Param("query") GroupSendJobQuery query);

    /**
     * 根据主任务id查询已发送数量
     * @param parentId
     * @return
     */
    Integer findFinishCountByParentId(@Param("parentId") Long parentId, @Param("merId") Long merId);

    /**
     * 根据主任务id查询总数量
     * @param parentId
     * @return
     */
    Integer findTotalCountByParentId(@Param("parentId") Long parentId, @Param("merId") Long merId);


}